package com.example.demo.dao;

import com.example.demo.po.Info;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;


/**
 * @desc:
 * @author: fuxiang
 * @date: 2018/3/2 11:51
 */
@Mapper
@CacheConfig(cacheNames = "info")
public interface InfoRepository  {
    @Select("select name  from info where id=#{id}")
    @Cacheable(key ="#p0")
    Info getAll(String id);

    @CachePut(key = "#p0")
    @Update("update info set name=#{name} where id=#{id}")
    int updataById(@Param("id") String id, @Param("name") String name);

}
